var Promisify = require('utils/http-promise.js')

App({
  data:{
    // httphost: "http://192.144.188.160:8080/",
    //httpserver: "http://192.144.188.160:8081/mallapp/",
    httphost: "https://zy.gushanzicun.com/",
    httpserver: "https://zy.gushanzicun.com/mallapp/",
    
    //httphost: "http://192.168.43.24:8080/",
    //httpserver: "http://192.168.43.24:8081/mallapp/",
   
  },
  onLaunch: function() {
    // 调用API从本地缓存中获取数据
    console.log("app***************2"+wx.getStorageSync('session_id'));
    var session_id = wx.getStorageSync('session_id');
    var header = wx.getStorageSync('header');
    if (session_id == '') {
      wx.redirectTo({
        url: '/pages/index/index'
      })
    }else{
      wx.request({
        url: this.data.httpserver + 'check_session_out',
        header: header,
        success: function (request) {
          console.log('result-' + request.data.result);
          var result = request.data.result;
          if (result == 1005) {
            wx.redirectTo({
              url: '/pages/index/index'
            })
          }
          
        }
      })
    } 
  },
  onShow(){
   // this.onLaunch();
  },
  getUserInfo: function() {
    
  },

  globalData: {
    userInfo: wx.getStorageSync('userInfo'),
    header: wx.getStorageSync('header'),
    session_id:wx.getStorageSync('session_id'),
    cardType:"",
  },

})
